html, body {
    margin: 0;
    padding: 0;
}

html {
    font-size: 20px;
    overflow: hidden;
    overflow-y: scroll;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, Segoe UI, PingFang SC, Hiragino Sans GB, Microsoft YaHei, Helvetica Neue, Helvetica, Arial, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol;
    font-variant: tabular-nums;
    line-height: 1.5;
    background: url("../bg.svg") no-repeat fixed;
}

@media only screen and (min-width: 401px) {
    html {
        font-size: 25px !important;
    }
}

@media only screen and (min-width: 428px) {
    html {
        font-size: 26.75px !important;
    }
}

@media only screen and (min-width: 481px) {
    html {
        font-size: 30px !important;
    }
}

@media only screen and (min-width: 569px) {
    html {
        font-size: 35px !important;
    }
}

@media only screen and (min-width: 641px) {
    html {
        font-size: 40px !important;
    }
}

input, button {
    border-radius: 0;
    border: 1px solid #aaaaaa;
}

input:focus, button:focus {
    border-color: #0366d6;
    box-shadow: 0 0 0 4px #c9e3ff;
    outline: 0;
}

.loading {
    position: fixed;
    background-color: rgba(255, 255, 255, 0.95);
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 100vh;
    flex-direction: column;
    opacity: 1;
    transition: opacity 0.25s ease-in-out;

    span {
        font-size: 16px;
        color: #999;
        margin-top: 10px;
    }

    .loading-icon {
        border: 4px solid rgba(0, 0, 0, 0.1);
        border-left-color: #007bff;
        border-radius: 50%;
        width: 30px;
        height: 30px;
        animation: spin 1s linear infinite;
    }
}

.loading.hidden {
    opacity: 0;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.bg_wrapper {
    width: auto;
    height: auto;
    min-width: 100%;
    min-height: 100%;
    margin: 0;
    padding: 0;
    position: fixed;
    top: 0;
    left: 0;
    z-index: -99;
    //filter: blur(5px);
    background-color: rgba(255, 255, 255, 0.65);
    //background-color: rgba(0, 0, 0, 0.5);
}

// 标题
header {
    color: #333;
    padding: 1rem 0;
    text-align: center;

    h1 {
        font-size: 1.5rem;
        text-transform:uppercase;
        margin: 0 0 20px 0;
        color: #9297b7;
    }

    h2 {
        font-size: 1.0rem;
        margin: 0 0 20px 0;
    }

    p {
        font-size: 0.45rem;
    }
}

footer {
    text-align: center;
    font-size: 0.4rem;
    height: 1rem;
    line-height: 1rem;
    padding-bottom: 0.5rem;
    color: #333;

    a {
        color: #333;
    }
}

// 主体
.app-main {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    color: #2c3e50;
    width: 80%;
    margin: 0 auto 40px auto;
    background: #ffffff;
    position: relative;
    box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.2), 0 25px 50px 0 rgba(0, 0, 0, 0.1);

    &:after {
        content: "";
        position: absolute;
        right: 0;
        bottom: 0;
        left: 0;
        height: 50px;
        overflow: hidden;
        box-shadow: 0 1px 1px rgba(0, 0, 0, 0.2), 0 8px 0 -3px #f6f6f6, 0 9px 1px -3px rgba(0, 0, 0, 0.2), 0 16px 0 -6px #f6f6f6, 0 17px 2px -6px rgba(0, 0, 0, 0.2);
    }

    // 头部
    .main-header {
        display: flex;

        .write-do-icon {
            width: 40px;
            height: 40px;
            font-size: 0;
            position: absolute;
            top: 20px;
            left: 10px;
            background-image: url('../icons/write.svg');
            background-repeat: no-repeat;
            background-position: center center;
            z-index: 20;
        }

        .toggle-all {
            background: none;
            text-align: center;
            border: none;
            opacity: 0;
            position: absolute;

            + label.check-all-icon {
                width: 40px;
                height: 40px;
                font-size: 0;
                position: absolute;
                top: 20px;
                left: 10px;
                background-image: url('../icons/checkall.svg');
                background-repeat: no-repeat;
                background-position: center center;
                z-index: 20;

                &:hover {
                    background-image: url('../icons/checkall-active.svg');
                }
            }

            &:checked + label.check-all-icon {
                background-image: url('../icons/checkall-active.svg');
            }
        }

        .input-value {
            font-size: 0.5rem;
            height: 2.0rem;
            padding: 0 0 0 1.5rem;
            flex-grow: 1;
            background: #fafafa;
            border-width: 1px 0;
            border-style: solid;
            border-color: #e0e0e0;
            box-sizing: border-box;
            box-shadow: inset 0 0 5px 0 rgba(232, 232, 232, 0.5);
            z-index: 15;

            &:focus {
                background: #ffffec;
                border-top-color: #e0e0e0;
                border-bottom-color: #d0d0d0;
                box-shadow: none;
            }

            &::-webkit-input-placeholder {
                color: #c0c0c0;
            }
        }
    }

    // 列表
    .main-body {
        min-height: 350px;

        .todo-list {
            margin: 0;
            padding: 0;
            border-top: 1px solid #f5f5f5;

            li {
                position: relative;
                font-size: 0.5rem;
                border-bottom: 1px solid #ededed;
                list-style: none;
                z-index: 20;

                &:hover {
                    background-color: #f5f5f5;
                }

                &:last-child {
                    border-bottom: none;
                }

                .edit {
                    display: none;
                }

                .toggle {
                    text-align: center;
                    width: 60px;
                    position: absolute;
                    top: 0;
                    bottom: 0;
                    margin: 0 auto;
                    border: none;
                    -webkit-appearance: none;
                    appearance: none;
                    opacity: 0;

                    + label.check-icon {
                        background-image: url('../icons/checkbox.svg');
                        background-repeat: no-repeat;
                        background-position: 12px center;
                    }

                    &:checked + label.check-icon {
                        background-image: url('../icons/checkbox-active.svg');
                    }
                }

                label {
                    word-break: break-all;
                    padding: 15px 15px 15px 60px;
                    display: inline-block;
                    line-height: 1.2;
                    transition: color 0.4s;
                    width: 85%;
                }

                &.completed {
                    label {
                        color: #d9d9d9;
                        text-decoration: line-through;
                    }
                }

                .delete-btn {
                    position: absolute;
                    top: 7px;
                    right: 10px;
                    width: 40px;
                    height: 40px;
                    line-height: 40px;
                    margin: 0 auto;
                    transition: color 0.2s ease-out;
                    background: none;
                    border: none;
                    padding: 0;

                    &:focus {
                        box-shadow: none;
                    }
                }

                &:hover .delete-btn {
                    display: block;
                    background-image: url('../icons/remove-active.svg');
                    background-repeat: no-repeat;
                    background-position: center center;
                }

                &.editing {
                    .view {
                        display: none;
                    }

                    .edit {
                        display: block;

                        input {
                            word-break: break-all;
                            padding: 15px 0;
                            display: inline-block;
                            line-height: 1.2;
                            transition: color 0.4s;
                            width: 100%;
                            border: none;
                            text-indent: 20px;
                            font-size: 0.5rem;
                            background-color: #ffffdc;
                            box-shadow: 0 0 0 4px rgba(201, 227, 255, 0.65);
                            border-radius: 3px;
                        }
                    }
                }
            }
        }

        .list-empty {
            width: 514px;
            height: 260px;
            margin: 0 auto;
            background: url("../list-empty.svg") no-repeat center 30px;
            background-size: 45%;
            text-align: center;
            font-size: 0.45rem;
            color: #aaaaaa;
            font-weight: normal;

            span {
                display: inline-block;
                padding-top: 210px;
            }
        }
    }

    // 底部
    .main-footer {
        color: #777777;
        padding: 10px;
        height: 20px;
        line-height: 20px;
        text-align: center;
        border-top: 1px solid #e6e6e6;
        font-size: 0.35rem;

        .inner-left {
            span {
                float: left;
                text-align: left;
                z-index: 10;
            }
        }

        .inner-center {
            margin: 0 auto;
            padding: 0;
            list-style: none;
            position: absolute;
            right: 0;
            left: 0;

            .tabs {
                position: relative;
                padding: 0;
                margin: 0;
                display: inline-flex;
                z-index: 10;

                li {
                    float: left;
                    list-style: none;

                    a {
                        color: inherit;
                        margin: 3px;
                        padding: 3px 7px;
                        text-decoration: none;
                        border: 1px solid transparent;
                        border-radius: 3px;

                        &:hover {
                            border-color: #d0d0d0;
                        }

                        &:focus {
                            //border-color: #0366d6;
                            box-shadow: 0 0 0 4px #c9e3ff;
                            outline: 0;
                        }
                    }

                    &.active {
                        a {
                            border-color: #d9d9d9;
                            background-color: #ededed;
                        }
                    }
                }
            }
        }

        .inner-right {
            float: right;
            position: relative;
            line-height: 20px;
            text-decoration: none;
            cursor: pointer;

            .clear-completed, .clear-completed:active {
                position: relative;
                text-decoration: none;
                cursor: pointer;
            }

            .clear-completed {
                position: relative;
                top: -3px;
                color: inherit;
                border-color: #d9d9d9;
                border-radius: 3px;
                background-color: transparent;
                padding: 4px 5px;
                z-index: 10;

                &:hover {
                    border-color: #d0d0d0;
                    background-color: #f0f0f0;
                    text-decoration: none;
                }

                &:disabled {
                    border-color: #d8d8d8;
                    background-color: #f0f0f0;
                    text-decoration: none;
                    color: #aaa;
                    text-shadow: 1px 1px #fff;
                    cursor: not-allowed;
                }
            }
        }
    }
}
